/**
 * Copyright &copy; 2016-2017 <a href="http://git.oschina.net/whoamien/backend_management">Backend Management</a> All rights reserved.
 */
package com.xw.framework.vo;

import java.io.Serializable;
import java.util.Objects;

/**
 * The Class ShiroUser.
 *
 * @author Xi Wei
 */
public class ShiroUser implements Serializable {

	/** The id. */
	public Long id;
	
	/** The login name. */
	public String loginName;
	
	/** The name. */
	public String name;
	
	/** The system id. */
	public Long systemId;
	
	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	
	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(Long id) {
		this.id = id;
	}
	
	/**
	 * Gets the login name.
	 *
	 * @return the login name
	 */
	public String getLoginName() {
		return loginName;
	}
	
	/**
	 * Sets the login name.
	 *
	 * @param loginName the new login name
	 */
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	
	
	/**
	 * Gets the system id.
	 *
	 * @return the system id
	 */
	public Long getSystemId() {
		return systemId;
	}
	
	/**
	 * Sets the system id.
	 *
	 * @param systemId the new system id
	 */
	public void setSystemId(Long systemId) {
		this.systemId = systemId;
	}
	
	/**
	 * Instantiates a new ShiroUser.
	 *
	 * @param id the id
	 * @param loginName the login name
	 * @param name the name
	 */
	public ShiroUser(Long id, String loginName, String name) {
		this.id = id;
		this.loginName = loginName;
		this.name = name;
	}
	
	/**
	 * Instantiates a new ShiroUser.
	 *
	 * @param id the id
	 * @param loginName the login name
	 * @param name the name
	 * @param systemId the system id
	 */
	public ShiroUser(Long id, String loginName, String name,Long systemId) {
		this.id = id;
		this.loginName = loginName;
		this.name = name;
		this.systemId = systemId;
	}
	
	/**
	 * 本函数输出将作为默认的<shiro:principal/>输出.
	 *
	 * @return the string
	 */
	@Override
	public String toString() {
		return loginName;
	}
	
	/**
	 * 重载hashCode,只计算loginName;.
	 *
	 * @return the int
	 */
	@Override
	public int hashCode() {
		return Objects.hashCode(loginName);
	}
	
	/**
	 * 重载equals,只计算loginName;.
	 *
	 * @param obj the obj
	 * @return true, if successful
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		ShiroUser other = (ShiroUser) obj;
		if (loginName == null) {
			if (other.loginName != null) {
				return false;
			}
		} else if (!loginName.equals(other.loginName)) {
			return false;
		}
		return true;
	}
}
